package github.kawaiior.yuanchuxiuzhen.common.item.test;

import github.kawaiior.yuanchuxiuzhen.common.capability.entity.ManaPower;
import github.kawaiior.yuanchuxiuzhen.common.item.YcxzItem;
import github.kawaiior.yuanchuxiuzhen.core.registry.ModCapability;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.world.World;
import net.minecraftforge.common.util.LazyOptional;

public class LevelUp extends YcxzItem {

    @Override
    public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
        if (worldIn.isRemote){

        }else {
            LazyOptional<ManaPower> capability = playerIn.getCapability(ModCapability.MANA_POWER);
            capability.ifPresent((power)->{
                power.innerLevelUp(worldIn);
            });
        }
        return super.onItemRightClick(worldIn, playerIn, handIn);
    }

}
